const path = require('path'),
	  CleanWebpackPlugin = require('clean-webpack-plugin'); // 清空发布目录的插件

module.exports = {
	entry: {
		'pages/page1/page': './src/pages/page1/page.js',
		'pages/page2/page': './src/pages/page2/page.js',
		'pages/page3/page': './src/pages/page3/page.js',
	},

	output: {
		path: path.resolve(__dirname, './dist/'),
		filename: '[name].bundle.js'
	},

	module: {
		loaders:[
			{
				test: /\.js[x]?$/,
				exclude: /node_modules/,
				loader: 'babel-loader?presets[]=es2015'
			},
		]
	},

	plugins: [
		new CleanWebpackPlugin(['dist'], {
	        root: '', // An absolute path for the root  of webpack.config.js
	        verbose: true,// Write logs to console.
	        dry: false // Do not delete anything, good for testing.
    	}),
	]
}